home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c++ / 15 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  2.2 KB

  1. Path: library.erc.clarkson.edu!rpi!not-for-mail
  2. From: Etay_Bogner@mail.stil.scitex.com (Etay Bogner)
  3. Newsgroups: comp.lang.c++.moderated,comp.std.c++
  4. Subject: Re: ANSI/ISO Exception Hierarchy
  5. Date: 9 Jan 1996 10:06:59 -0000
  6. Organization: Scitex Corp.
  7. Sender: cppmods@netlab.cs.rpi.edu
  8. Approved: kanze@lts.sel.alcatel.de
  9. Message-ID: <4cteo4$32o@netlab.cs.rpi.edu>
  10. References: <4cgog4$jsq@netlab.cs.rpi.edu> <4cipio$pcj@netlab.cs.rpi.edu> <4crabd$91f@netlab.cs.rpi.edu>
  11. NNTP-Posting-Host: netlab.cs.rpi.edu
  12.  
  13. X-Original-Date: Tue, 09 Jan 1996 10:22:25 +0200
  14.  
  15. In article <4crabd$91f@netlab.cs.rpi.edu>, kanze@gabi-soft.fr (J. Kanze) wrote:
  16.  
  17. >> |> The design of the exception classes has changed since Plauger's book was
  18. >> |> written, and class "exception" no longer has a member function "raise".
  19. >> |> The exception classes now have only
  20. >> |>      default constructor
  21. >> |>      copy constructor
  22. >> |>      assignment operator
  23. >> |>      virtual destructor
  24. >> |>      virtual function "const char* what() const;"
  25. >> 
  26. >> |> The "what" function returns an implementation-defined null-terminated
  27. >> |> character string.
  28.  
  29. I would suggest that it will return a :
  30.  
  31. typeid(*this).name() 
  32.  
  33. as the standard default behavior. This way we don't add another global
  34. string to  the executable's data area, and we re-use the already existing
  35. string ( which represents the name of the exception ).
  36.  
  37. >> Does this include the constructors?  I don't see where this is stated in
  38. >> the draft, and as most of the constructors (except bad_alloc and
  39. >> bad_exception) take a reference to a string, I would expect them to
  40. >> invoke the copy constructor for string, which I presume *can* throw
  41. >> bad_alloc.
  42.  
  43. I believe that the string class would best implememnted as a
  44. copy-on-change class, which means that the copy-constructor will not
  45. actually duplicate the string but will increase the reference counter it
  46. uses.
  47.  
  48. - -- 
  49. - -- Etay Bogner,
  50. - -- Etay_Bogner@mail.stil.scitex.com,
  51. - -- Scitex Corp.
  52. - -- Israel.
  53.  
  54.     [ comp.lang.c++.moderated is a moderated newsgroup.  Submit articles ]
  55.     [  to <c++-submit@netlab.cs.rpi.edu>.  The moderation policy can be  ]
  56.     [   retrieved from <http://netlab.cs.rpi.edu/~cppmods/guide.html>.   ]
  57.     [    Moderators can be reached at: c++-request@netlab.cs.rpi.edu.    ]
  58.